<template>
	<view class="brief">
		<view class="top-box">
			<u-form v-model="cleanerForm" ref="cleanerRef" :border-bottom="false">
				<u-form-item :border-bottom="false">
					<view class="input-box" @click="dipShow = true">
						<view class="input-left title">学历</view>
						<view class="input-right">{{ cleanerForm.education || '请选择' }}</view>
						<view class="input-icon">
							<u-icon name="arrow-right" color="#C0C0C0"></u-icon>
						</view>
					</view>
				</u-form-item>
				<u-form-item :border-bottom="false">
					<view class="input-box" @click="natShow = true">
						<view class="input-left title">民族</view>
						<view class="input-right">{{ cleanerForm.notion || '请选择' }}</view>
						<view class="input-icon">
							<u-icon name="arrow-right" color="#C0C0C0"></u-icon>
						</view>
					</view>
				</u-form-item>
				<u-form-item :border-bottom="false">
					<view class="input-box" @click="heigShow = true">
						<view class="input-left title">身高</view>
						<view class="input-right">{{ cleanerForm.height ||  '请选择' }}</view>
						<view class="input-icon">
							<u-icon name="arrow-right" color="#C0C0C0"></u-icon>
						</view>
					</view>
				</u-form-item>
				<u-form-item :border-bottom="false">
					<view class="input-box" @click="weigShow = true">
						<view class="input-left title">体重</view>
						<view class="input-right">{{ cleanerForm.weight || '请选择' }}</view>
						<view class="input-icon">
							<u-icon name="arrow-right" color="#C0C0C0"></u-icon>
						</view>
					</view>
				</u-form-item>
			</u-form>
		</view>
		<view class="bom-box">
			<u-input v-model="cleanerForm.introduction" type="textarea" height="350" auto-height="false"
				:clearable="false" maxlength="300" placeholder="可根据您的工作经历、擅长领域等方面进行填写。个人简介越生动详细,越多用户下单哦" />
			<view class="txt-number">{{cleanerForm.introduction.length}}/300</view>
		</view>

		<!-- 底部 -->
		<view class="footer">
			<button class="btn" @click="dosave">保存</button>
		</view>

		<!-- 学历弹出层 -->
		<u-select v-model="dipShow" :list="dipList" mode="single-column" @confirm="confirmOne"></u-select>
		<!-- 2 -->
		<u-select v-model="natShow" :list="natList" mode="single-column" @confirm="confirmTwo"></u-select>
		<!-- 3 -->
		<u-select v-model="heigShow" :list="heigList" mode="single-column" @confirm="confirmThree"></u-select>
		<!-- 4 -->
		<u-select v-model="weigShow" :list="weigList" mode="single-column" @confirm="confirmFour"></u-select>
	</view>
</template>

<script>
	import { dipList, natList, heigList, weigList } from '@/untils/infodata.js'
	export default {
		data() {
			return {
				cleanerForm: {
					education: '',
					notion: '',
					height: '',
					weight: '',
					introduction: ''
				},
				dipShow: false,
				natShow: false,
				heigShow: false,
				weigShow: false,
				dipList: dipList,
				natList: natList,
				heigList: heigList,
				weigList: weigList
			}
		},

		methods: {
			dosave() {
				if (!this.cleanerForm.education) return uni.$showMsg('请选择学历')
				if (!this.cleanerForm.notion) return uni.$showMsg('请选择民族')
				if (!this.cleanerForm.height) return uni.$showMsg('请选择身高')
				if (!this.cleanerForm.weight) return uni.$showMsg('请选择体重')
				if (!this.cleanerForm.introduction) return uni.$showMsg('请输入个人简历')

				uni.$emit('upinfo', this.cleanerForm)
				uni.navigateBack()
			},
			confirmOne(e) {
				this.cleanerForm.education = e[0].label
			},
			confirmTwo(e) {
				this.cleanerForm.notion = e[0].label
			},
			confirmThree(e) {
				this.cleanerForm.height = e[0].label
			},
			confirmFour(e) {
				this.cleanerForm.weight = e[0].label
			}
		}
	}
</script>

<style lang="scss" scoped>
	.brief {
		background-color: #f7f7f7;
		padding: 0 18rpx 128rpx 30rpx;
		overflow: hidden;

		.top-box,
		.bom-box {
			margin-top: 20rpx;
			background: #FFFFFF;
			border-radius: 24rpx;
			padding: 38rpx 34rpx 32rpx 20rpx;
		}

		// 上
		.top-box {
			padding-top: 0;

			/deep/.u-form-item {
				padding-bottom: 0;
			}

			.input-box {
				display: flex;
				font-size: 26rpx;
				position: relative;


				.title {
					width: 100rpx;
					font-weight: 700;
				}

				.input-right {
					flex: 1;
					border-bottom: 1px solid #F0EDED;
					padding-bottom: 20rpx;
					color: #c0c4cc;
				}

				.input-icon {
					position: absolute;
					top: 0;
					right: 10rpx;
				}
			}
		}

		// 下
		.bom-box {
			.txt-number {
				font-size: 26rpx;
				color: #818181;
				text-align: right;
			}
		}

		// 底部
		.footer {
			width: 100%;
			height: 128rpx;
			background-color: #fff;
			padding: 20rpx 0;
			z-index: 9;
			position: fixed;
			bottom: 0;
			left: 0;

			.btn {
				width: 676rpx;
				height: 84rpx;
				line-height: 84rpx;
				background-color: #01C3A8;
				color: #F3FFFE;
				font-size: 30rpx;
				border-radius: 42rpx;
			}

			button.btn::after {
				border: none;
			}
		}
	}
</style>
